package com.xiaoshuidi.cloud.module.contract.controller.admin.home;


import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.contract.controller.admin.contract.vo.HomeQueryVO;
import com.xiaoshuidi.cloud.module.contract.controller.admin.home.vo.HomeData;
import com.xiaoshuidi.cloud.module.contract.enums.ApiConstants;
import com.xiaoshuidi.cloud.module.contract.service.home.HomeServiceImpl;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

import static com.xiaoshuidi.cloud.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 工作台")
@RestController
@RequestMapping(ApiConstants.NAME + "/home")
@Validated
public class HomeController {
    
    @Resource
    private HomeServiceImpl homeService;

    /**
     * 工作台租客合同
     */
    @GetMapping("/get-home")
    public CommonResult getContract(HomeQueryVO req) {
        HomeData homeData = homeService.getHomeData(req);
        return success(homeData);
    }
    /**
     * pc工作台 月日历
     */
    @GetMapping("/get-month-data")
    public CommonResult<List<Map<LocalDate,Boolean>>> getHomeMonthData(HomeQueryVO req) {
        List<Map<LocalDate,Boolean>> homeData = homeService.getHomeMonthData(req);
        return success(homeData);
    }

    /**
    * app工作台 账单
    * */
    @GetMapping("/get-month-bill")
    public CommonResult<List<Map<LocalDate,Boolean>>> getHomeMonthBill(HomeQueryVO req) {
        List<Map<LocalDate,Boolean>> homeData = homeService.getHomeMonthBill(req);
        return success(homeData);
    }
    /**
     * app工作台 合同
     * */
    @GetMapping("/get-month-contract")
    public CommonResult<List<Map<LocalDate,Boolean>>> getHomeMonthContract(HomeQueryVO req) {
        List<Map<LocalDate,Boolean>> homeData = homeService.getHomeMonthContract(req);
        return success(homeData);
    }


}
